home *** CD-ROM | disk | FTP | other *** search
- //: C20:FEditTest.cpp
- // From Thinking in C++, 2nd Edition
- // Available at http://www.BruceEckel.com
- // (c) Bruce Eckel 1999
- // Copyright notice in Copyright.txt
- //{L} FileEditor
- // Test the FileEditor tool
- #include "FileEditor.h"
- #include "../require.h"
- #include <sstream>
- using namespace std;
-
- int main(int argc, char* argv[]) {
- requireArgs(argc, 1);
- FileEditor file(argv[1]);
- // Do something to the lines...
- int i = 1;
- FileEditor::iterator w = file.begin();
- while(w != file.end()) {
- ostringstream ss;
- ss << i++;
- *w = ss.str() + ": " + *w;
- w++;
- }
- // Now send them to cout:
- file.write();
- } ///:~
-